feat: Add native Google Gemini provider support#9
Conversation
Agent-Logs-Url: https://github.com/WebCafeTech/AutoCodeWikiAI/sessions/30c65042-5c26-476a-abb0-b986a51d2b9f Co-authored-by: mukund-gohil-atos <82583411+mukund-gohil-atos@users.noreply.github.com>
Agent-Logs-Url: https://github.com/WebCafeTech/AutoCodeWikiAI/sessions/30c65042-5c26-476a-abb0-b986a51d2b9f Co-authored-by: mukund-gohil-atos <82583411+mukund-gohil-atos@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01d13285e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif provider == "gemini": | ||
| # Use Google Gemini SDK | ||
| from google import genai | ||
| gemini_client = genai.Client(api_key=api_key) | ||
| list(gemini_client.models.list()) |
There was a problem hiding this comment.
Skip mandatory base URL for Gemini validation
The new Gemini connectivity branch is not reachable for the documented Gemini setup because this command still hard-fails earlier when config.base_url is empty (config_validate step 3 exits at lines 509-512). Since the README example added in this commit configures Gemini without --base-url, users can select --provider gemini but then fail validation (and related configured-state checks) before Gemini-specific API testing runs. Make base-URL validation provider-aware (or set a Gemini default URL) so Gemini configs can pass.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Adds Google Gemini as a first-class LLM provider option across the CLI, backend LLM call routing, and user-facing documentation, aiming to remove the need for an OpenAI-compatible proxy setup for Gemini.
Changes:
- Added a native Gemini call path in
call_llm()via thegoogle-genaiSDK. - Exposed
geminias a selectable provider in CLI config + added a Gemini connectivity check. - Updated docs/config comments to include Gemini in the supported provider list and examples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Documents Gemini as a supported provider and adds a Gemini config example. |
| codewiki/src/config.py | Updates provider documentation/comments to include gemini. |
| codewiki/src/be/llm_services.py | Routes provider=gemini to a new _call_llm_via_gemini() implementation using google-genai. |
| codewiki/cli/commands/config.py | Adds gemini to --provider choices and a Gemini connectivity check in config validate. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Google Gemini | ||
| codewiki config set \ | ||
| --provider gemini \ | ||
| --api-key YOUR_GEMINI_API_KEY \ |
There was a problem hiding this comment.
The Gemini quick-start omits --base-url, but the CLI configuration model and config validate currently require base_url to be set (and will error with “Base URL not set” before reaching the Gemini connectivity test). Either update the docs to include a valid Gemini base URL (or explain that an existing base URL must remain set), or adjust configuration/validation logic to make base_url optional when provider=gemini.
| --api-key YOUR_GEMINI_API_KEY \ | |
| --api-key YOUR_GEMINI_API_KEY \ | |
| --base-url https://generativelanguage.googleapis.com \ |
| if provider in ("bedrock", "anthropic"): | ||
| return _call_llm_via_litellm(prompt, config, model, temperature) | ||
|
|
||
| if provider == "azure-openai": | ||
| return _call_llm_via_azure(prompt, config, model, temperature) | ||
|
|
||
| if provider == "gemini": | ||
| return _call_llm_via_gemini(prompt, config, model, temperature) | ||
|
|
There was a problem hiding this comment.
call_llm() now routes provider == "gemini" through _call_llm_via_gemini(), but the rest of the backend still constructs pydantic_ai agents via create_fallback_models() which always uses OpenAIModel/OpenAIProvider (i.e., OpenAI-compatible HTTP). With provider=gemini, leaf/agent-driven documentation generation will still attempt OpenAI-style calls (and may fail if llm_base_url isn’t configured). Consider updating model/agent creation to use a Gemini-capable pydantic-ai model/provider when config.provider == "gemini", or refactor the agent path to use the same Gemini SDK call path.
| elif provider == "gemini": | ||
| # Use Google Gemini SDK | ||
| from google import genai | ||
| gemini_client = genai.Client(api_key=api_key) | ||
| list(gemini_client.models.list()) |
There was a problem hiding this comment.
The Gemini connectivity test added here is gated by earlier validation that always requires config.base_url to be set and valid. This makes the Gemini provider UX inconsistent (Gemini doesn’t need a base URL, and the README example omits it) and means a fresh Gemini-only config will fail before reaching this branch. Consider skipping the base-URL-required check when provider == "gemini" (and avoid printing/validating it), or auto-populate a sensible default base URL when users select the Gemini provider.
Gemini models required a manual LiteLLM proxy setup via
openai-compatible— undocumented and requiring extra infrastructure. This addsgeminias a first-class provider using thegoogle-genaiSDK already present inrequirements.txt.Changes
llm_services.py: Added_call_llm_via_gemini()usinggoogle.genai.Clientdirectly; routesgeminiprovider incall_llm(); stripsgemini/litellm prefix from model names; validates response before returningconfig.py: Addedgeminito the provider comment/docstringcli/commands/config.py: Addedgeminito--providerclick.Choice; added Gemini connectivity test inconfig validateREADME.md: Added Gemini to provider list and quick-start exampleUsage
codewiki config set \ --provider gemini \ --api-key YOUR_GEMINI_API_KEY \ --main-model gemini-2.5-pro \ --cluster-model gemini-2.5-pro